﻿<ComClass(MyExcelFunction.ClassId, MyExcelFunction.InterfaceId, MyExcelFunction.EventsId)> _
Public Class MyExcelFunction

#Region "COM GUID"
    ' 这些 GUID 提供此类的 COM 标识 
    ' 及其 COM 接口。若更改它们，则现有的
    ' 客户端将不再能访问此类。
    Public Const ClassId As String = "4dcd6ed7-e107-49f7-9f74-3d8916b4deb1"
    Public Const InterfaceId As String = "1eb97690-69d6-4a37-8575-532a1cff531e"
    Public Const EventsId As String = "dc1aaa15-2921-41a4-b171-4dd641f680f2"
#End Region

    ' 可创建的 COM 类必须具有一个不带参数的 Public Sub New() 
    ' 否则， 将不会在 
    ' COM 注册表中注册此类，且无法通过
    ' CreateObject 创建此类。
    Public Sub New()
        MyBase.New()
    End Sub


    Public ReadOnly Property ExcelApp As Microsoft.Office.Interop.Excel.Application
        Get
            Return Microsoft.VisualBasic.Interaction.GetObject(Nothing, "Excel.Application")
        End Get
    End Property



End Class


